<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><{if !$res}>新增产品<{else}>产品管理<{/if}></title>
<link href="./css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
/*.edit table td div{margin:2px 5px 3px 0; padding:0; float:left;border:1px solid #DCDBDB;}
.edit table td div p{margin:0px; padding:0;background:#F4F4F4; line-height:30px; text-align:center;}*/
#upload_queue {
	position: absolute;
	background-color:#CFF;
	border:1px solid #09F;
	height:10px;
	margin-bottom: 10px;
	padding:10px;
	overflow:hidden;
	width: 374px;
	display:none
}
.img_pre_img {
	border: 1px solid #09F;
	display: inline-block;
	margin:2px;
	height: 60px;
	overflow: hidden;
	width: 100px;
}
.img_prev_orginal {
	position:absolute;
	margin-bottom:0px;
	width:600px;
	height:auto;
	border:1px solid #00F;
	background:#FFC
}
#file_uploadQueue {
	position:relative;
	background:#FFF;
	z-index:911119999;
}
#cancel_all_button {
	position: absolute;
	margin-left:385px;
	margin-top:-8px;
	z-index:100000;
	border:0px;
	display:none
}
#startupload:hover {
	background:none;
	outline: none;
}
.img_remove:hover {
	background:none;
	outline: none;
}
.uploadifyError {
	background-color: #FDE5DD !important;
	border: 2px solid #FBCBBC !important;
}
.uploadifyQueueItem {
	background-color: #F5F5F5;
	border: 1px solid #09C;
	font: 11px Verdana, Geneva, sans-serif;
	margin-top: 2px;
	padding: 1px;
	width: 250px;
}
</style>
<{insert_scripts files="./js/jquery.min.js,swfobject.js,jquery.uploadify.v2.1.4.min.js,./include/kindeditor/kindeditor-min.js,./include/kindeditor/lang/zh_CN.js"}>
<script type="text/javascript">
        var editor,editor2,editor3;
		var options = {
        cssPath : '/include/kindeditor/examples/index.css',
        filterMode : true,
		allowFileManager : true,
		};
        KindEditor.ready(function(K) {
                editor = K.create('#editor_1', {
                        themeType : 'common',
						uploadJson : './index.php?c=upload&a=upload_json',
						fileManagerJson : './index.php?c=upload&a=file_manager_json',
						allowFileManager : true
                });						
        });		
</script>
</head>
<body>
<form name="Form1" method="post" action="index.php?c=admin&a=products&mod=edit&act=saveAction" id="Form1" enctype="multipart/form-data">
  <{if $res}>
  <input type="hidden" name="productId" value="<{$res.id}>" />
  <{/if}>
  <div class="box">
    <div class="box2">
      <table border=0 cellpadding=0 cellspacing=0>
        <tr>
          <th style="border-bottom: #cccccc 1px solid">归类：</th>
          <td width="200">
<select name="products_fid" id="products_fid">         
 <{function name=menu level=0}>
		    <{foreach $data as $entry}>
            <{if $level==0}>
            <optgroup label="<{$entry.datil}>"> 
            <{else}>
			        <option value="<{$entry.id}>"  <{if $res.fid==$entry.id}>selected="selected"<{/if}>>       
                    ├<{for $foo=0 to $level}>&#45;&#45;<{/for}><{$entry.datil}>
                    </option>
             <{/if}>         
			<{if isset($entry.child)}>
				<{call name=menu data=$entry.child level=$level+1}>
			<{/if}>
            <{if $level==0}>                       
               </optgroup> 
            <{/if}>   
		<{/foreach}>
<{/function}>   
<{call name=menu data=$arr}>  
            </select>    
          </td>
          <td ></td>
        </tr>
      </table>
    </div>
    <div class=box2>
      <table border=0 cellpadding=0 cellspacing=0>
        <tr>
          <th id='html_title'>名称：</th>
          <td><input  name="name" id="name" type="text" value="<{if $res.product_name}><{$res.product_name}><{/if}>" style="width:320px" /></td>
        </tr>
        <tr>
          <th style="border-bottom: #cccccc 1px solid">排序：</th>
          <td><input  name="show_order" id="show_order" type="text" value="<{if $res.show_order}><{$res.show_order}><{else}>0<{/if}>" style="width:160px"  />
            <font color="#990000">&nbsp;&nbsp;&nbsp;[提示:前台显示时，数值越大显示越靠前]</font></td>
        </tr>
        <tr>
          <th id='html_title'>列表封面：</th>
          <td ><div  id="image_input_holder" style=" float:left; width:680px;<{if !$res.product_thumb}>display:none<{/if}>" >
              <input  name="thumb" id="thumb" type="text"  style="width:320px;" value="<{if $res.product_thumb}><{$res.product_thumb}><{/if}>" readonly="readonly"/>
            </div>
            <div id="uploadbtn" style="width:680px; height:40px; float:left"><span id="btn_main" style="display:block; width:120px; height:30px; float:left; margin-top:10px;">
              <input id="file_upload" type="file" name="file_upload" />
              </span><span id="btn_dis" style=" display:block;margin-top:10px; float:left; line-height:30px; padding-left:20px; "><{if !$res.product_thumb}>[提示:远程图片的完整链接，或上传图片;图片尺寸请控制在?*?px或相同比例的大图]<{else}>[产品封面已经存在，如需修改，点击左侧选取文件]<{/if}></span></div></td>
        </tr>
      </table>
    </div>
  </div>
  <p style="padding: 15px; text-align: center;">
    <input type="submit" name="Button1" value="保存" id="Button1" class="add" style="font-weight:bold;width:70px;" />
    <input type="reset" name="Button3" value="重置 " id="Button3" class="add" style="font-weight:bold;width:70px;" />
  </p>
</form>
<script type="text/javascript">
$(function(){
  $('#file_upload').uploadify({
    'uploader'  : './include/uploadify/uploadify.swf',
    'script'    : './upload.php/1:1:0:0',
    'cancelImg' : './include/uploadify/cancel.png',
    'folder'    : './upload/cover/',
	'fileExt'   : '*.jpg;*.gif;*.png',
	'fileDesc'    : '请选择图片',
	'buttonImg' : './include/uploadify/button.jpg',
	'sizeLimit'   : 1024000,
    'auto'      :  true,
  	'onComplete'  : function(event, ID, fileObj, response, data) {
			if(response.match(/\/upload\//)){
				$("#thumb").val(response);
				$("#btn_main").hide();
				$("#btn_dis").html("<font color=red>[提示：图片已经成功上传，请勿修改上面文本框中的链接]</font>");
				$("#image_input_holder").show();
			}else{
				alert(response);
			}
     },
	 'onError'     : function (event,ID,fileObj,errorObj) {
      alert('上传中发生错误请稍后尝试！');
    }	
  });	 	
});	
</script>
</body>
</html>
